package com.ostrich.cloud.ostrichGoodsService.client;

import com.ostrich.cloud.common.result.PageResult;
import com.ostrich.cloud.common.result.Result;
import com.ostrich.cloud.ostrichGoodsSercice.model.Dto.GoodsDto;
import com.ostrich.cloud.ostrichGoodsSercice.model.param.CreateGoodsParam;
import com.ostrich.cloud.ostrichGoodsSercice.model.param.GetGoodsParam;
import com.ostrich.cloud.ostrichGoodsSercice.model.param.PutGoodsParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;


@FeignClient(contextId = "goodsClient",name="ostrichGoodsService")
public interface GoodsClient {

    @GetMapping("getDto")
    @ApiOperation("查询单个商品接口")
    public GoodsDto getGoodsDto(@RequestParam("goodsId") Integer goodsId);

    @PostMapping("createGood")
    @ApiOperation("创建商品接口")
    public boolean createGoods(@RequestBody @Valid CreateGoodsParam param);

    @GetMapping("allGood")
    @ApiOperation("查询全部商品接口")
    public PageResult<GoodsDto> getAllGoods(@RequestParam("current") Integer current,@RequestParam("size")Integer size);

    @PostMapping("criteriaQueries")
    @ApiOperation("条件查询商品接口")
    public PageResult<GoodsDto> getGoodsByCriteria(@RequestBody @Valid GetGoodsParam param);

    @PutMapping("putGood")
    @ApiOperation("修改商品接口")
    public boolean putGoods(@RequestBody @Valid PutGoodsParam param);

    @DeleteMapping("delGood")
    @ApiOperation("删除商品接口")
    public boolean delGoods(@RequestParam("goodsId")Integer goodsId);

    @GetMapping("hotGoods")
    @ApiOperation("查询热销商品接口")
    public Result HotGoods();


}
